﻿using ModernUILogViewer.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace ModernUILogViewer.Validation
{
    class LineRegexValidation : ValidationRule
    {
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            string blah = value != null ? value.ToString() : String.Empty;

            if (Utility.IsValidRegex(blah))
            {
                if (blah.StartsWith("^"))
                    return new ValidationResult(true, null);
                else
                    return new ValidationResult(false, "line regex must start with ^ char");      
            }
            else
                return new ValidationResult(false, "no valid regex");      
        }
    }
}
